<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <%--<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>--%>
    <title>橡树科技－JavaDemoSystem</title>
    <link type="text/css" rel="stylesheet" href="/static/styles/global.css"/>
    <link type="text/css" rel="stylesheet" href="/static/styles/global_color.css"/>
    <script language="javascript" type="text/javascript">
        function deleteRole(date) {
            var r = window.confirm("确定要删除此角色吗？");
            if (r) {
                document.location.href = "${pageContext.request.contextPath}/role/role_delete?rid="+date;
                document.getElementById("operate_result_info").style.display = "block";
            }
        }
    </script>
</head>
<body>
<div id="header"><img src="/static/images/logo.png" alt="logo" class="left"/> <a href="#">[退出]</a></div>
<div id="navi">
    <ul id="menu">
        <li><a href="${pageContext.request.contextPath}/index" class="index_on"></a></li>
        <c:forEach items="${list}" var="c">
            <li><a href="${pageContext.request.contextPath}/${c.url}" class="index_on"></a></li>
        </c:forEach>
        <li><a href="user/user_info.html" class="information_off"></a></li>
        <li><a href="user/user_modi_pwd.html"  class="password_off"></a></li>
    </ul>
</div>
<div id="main">
    <form action="" method="">
        <div class="search_add">
            <input type="button" value="增加" class="btn_add"
                   onClick="location.href='${pageContext.request.contextPath}/role/role_add'"/>
        </div>
        <div id="operate_result_info" class="operate_success"><img src="/static/images/close.png"
                                                                   onClick="this.parentNode.style.display='none';"/>
            删除成功！
        </div>


        <div id="data">
            <table id="datalist">
                <tr>
                    <th>角色 ID</th>
                    <th>角色名称</th>
                    <th class="width600">拥有的权限</th>
                    <th class="td_modi"></th>
                </tr>

                <c:forEach items="${pageInfo.list}" var="m">
                    <tr>
                        <td>${m.roleId}</td>
                        <td>${m.name}</td>
                        <td>${m.allModuleName}</td>
                        <td><input type="button" value="修改" class="btn_modify"
                                   onClick="location.href='${pageContext.request.contextPath}/role/role_modi?rid=${m.roleId}'"/>
                            <input type="button" value="删除" class="btn_delete" onClick="deleteRole(${m.roleId});"/></td>
                    </tr>
                </c:forEach>
            </table>
        </div>
        <div id="pages">
            <!--总记录数大于10条时显示分页 否则不显示分页信息-->
            <c:if test="${pageInfo.total > 1}">
                <a href="/role/role_list?page=1">首页</a>
                <!--判断是否是第一页. 是: 显示当前页. 否: 当前页减一-->
                <c:if test="${pageInfo.isFirstPage}">
                    <a href="/role/role_list?page=${pageInfo.pageNum}">上一页</a>
                </c:if>
                <c:if test="${!pageInfo.isFirstPage}">
                    <a href="/role/role_list?page=${pageInfo.pageNum - 1 }">上一页</a>
                </c:if>
                <!--循环显示页码-->
                <c:forEach begin="1" end="${pageInfo.pages}" step="1" var="index">
                    <c:if test="${pageInfo.pageNum==index}">
                        <a class="current_page" href="/role/role_list?page=${index}">${index}</a>
                    </c:if>
                    <c:if test="${pageInfo.pageNum!=index}">
                        <a href="/role/role_list?page=${index}">${index}</a>
                    </c:if>
                </c:forEach>
                <!--判断是否是最后一页. 是: 显示当前页. 否: 当前页加一 -->
                <c:if test="${pageInfo.isLastPage}">
                    <a href="/role/role_list?page=${pageInfo.pageNum}">下一页</a>
                </c:if>
                <c:if test="${!pageInfo.isLastPage}">
                    <a href="/role/role_list?page=${pageInfo.pageNum + 1 }">下一页</a>
                </c:if>
                <a href="/role/role_list?page=${pageInfo.pages}">末页</a>
            </c:if>
        </div>
    </form>
</div>
<div id="footer">
    <p>[源自顶端的技术，最优秀的师资，最真实的企业环境，最适用的实战项目]</p>
    <p>版权所有(C)橡树科技IT培训集团公司 </p>
</div>
</body>
</html>
